Jobs Sync Workflow
The Jobs Sync Workflow ensures that Bookadoc remains synchronized with AthenaHealth by periodically fetching:
- Open Appointment Slots – Available slots that patients can book is scheduled to run once at the beginning of the day (UTC).
- Booked Appointments – Appointments that have already been booked is scheduled to run every 10mins.
By keeping Bookadoc updated with real-time availability, this integration prevents double bookings and ensures providers' schedules remain accurate.
1. Syncing Open Appointment Slots
Bookadoc retrieves open appointment slots from AthenaHealth to display available times for patients.
Process Flow
- Bookadoc triggers a scheduled job at regular intervals.
- The system sends a request to AthenaHealth to fetch available appointment slots.
- The response is processed and stored in Bookadoc’s database.
- Patients can only book from the available slots.
API Endpoint
GET /v1/{practiceid}/appointments/open
Example Request
GET /v1/12345/appointments/open
Response Example
[
{
"appointmentid": "1861676",
"appointmentstatus": "o",
"providerid": "27",
"departmentid": "150",
"date": "02/07/2025",
"starttime": "08:00",
"duration": 15
}
]
Processing the Response
- Bookadoc extracts appointment slots where
appointmentstatus= "o" (open). - The data is stored in the local database and made available for patients to book.
- If no slots are available, the system prevents new bookings.
2. Syncing Booked Appointments
Bookadoc fetches booked appointments to ensure that all scheduling data matches AthenaHealth.
Process Flow
- Bookadoc triggers a scheduled job to retrieve all booked appointments.
- The system sends a request to AthenaHealth to fetch appointments that are no longer available for booking.
- The response is compared with Bookadoc’s database.
- Any mismatches are updated to keep records in sync.
API Endpoint
GET /v1/{practiceid}/appointments/booked
Example Request
GET /v1/12345/appointments/booked
Response Example
[
{
"appointmentid": "1861676",
"appointmentstatus": "f",
"providerid": "27",
"departmentid": "150",
"date": "02/07/2025",
"starttime": "08:00",
"duration": 15
}
]
Processing the Response
- Bookadoc identifies booked appointments where
appointmentstatus= "f" (filled). - These slots are marked as unavailable in Bookadoc’s system.
- If a patient attempts to book a slot that has already been taken, an error is shown.
3. Managing Appointment Slot Changes
Bookadoc subscribes to appointment slot changes in AthenaHealth, allowing real-time updates when appointments are modified.
API Endpoint
POST /v1/{practiceid}/appointments/subscribe
Example Request
{
"event": "appointment_slot_change",
"callback_url": "https://bookadoc.com/api/athena/appointment-updates"
}
Real-time Updates Process
- AthenaHealth sends a notification to Bookadoc when an appointment slot is booked, rescheduled, or canceled.
- Bookadoc updates its database accordingly.
- Patients and providers receive real-time updates about scheduling changes.
Error Handling
The Jobs Sync Workflow must handle errors efficiently to ensure data integrity.
Common Errors & Resolutions
| Error Code | Description | Resolution |
|---|---|---|
400 Bad Request | Invalid request parameters | Validate request before sending |
401 Unauthorized | Invalid credentials | Ensure authentication token is valid |
500 Internal Server Error | AthenaHealth service issue | Implement retries and log errors |
Conclusion
The Jobs Sync Workflow ensures that Bookadoc maintains an up-to-date appointment schedule by syncing open slots, booked appointments, and handling real-time slot changes. This synchronization prevents conflicts and enhances the efficiency of scheduling for healthcare providers and patients.